#include<bits/stdc++.h>
using namespace std;

const int N = 5010;
const int M = 10010;

struct node
{
	int next;
	int to;
	int id;
}edge[M << 1];

int head[N];
int DFN[N];
int low[N];
bool instack[N];
int block[N];
int deg[N];
stack <int> st;
int tot, sccnum, ord;

void addedge (int from, int to, int id)
{
	edge[tot].id = id;
	edge[tot].to = to;
	edge[tot].next = head[from];
	head[from] = tot++;
}

void init ()
{
	memset (DFN, -1, sizeof(DFN));
	memset (low, 0, sizeof(low));
	memset (instack, 0, sizeof(instack));
	memset (deg, 0, sizeof(deg));
	memset (head, -1, sizeof(head));
	while (!st.empty())
	{
		st.pop();
	}
	tot = sccnum = ord = 0;
}

void tarjan (int u, int x)
{
	DFN[u] = low[u] = ++ord;
	instack[u] = 1;
	st.push(u);
	for (int i = head[u]; ~i; i = edge[i].next)
	{
		int v = edge[i].to;
		if (x == edge[i].id)
		{
			continue;
		}
		if (DFN[v] == -1)
		{
			tarjan (v, edge[i].id);
			low[u] = min(low[u], low[v]);
		}
		else if (instack[v])
		{
			low[u] = min(low[u], DFN[v]);
		}
	}
	int v;
	if (DFN[u] == low[u])
	{
		++sccnum;
		do
		{
			v = st.top();
			st.pop();
			instack[v] = 0;
			block[v] = sccnum;
		}while (v != u);
	}
}

void solve (int n)
{
	for (int i = 1; i <= n; ++i)
	{
		if (DFN[i] == -1)
		{
			tarjan (i, -1);
		}
	}
	for (int u = 1; u <= n; ++u)
	{
		for (int j = head[u]; ~j; j = edge[j].next)
		{
			int v = edge[j].to;
			if (block[u] == block[v])
			{
				continue;
			}
		    ++deg[block[u]];
		    ++deg[block[v]];
		}
	}
	int cnt = 0;
	for (int i = 1; i <= sccnum; ++i)
	{
		if (deg[i] / 2 == 1)
		{
			++cnt;
		}
	}
	printf("%d\n", (cnt + 1) >> 1);
}

int main()
{
	int n, m;
	int u, v;
	while (~scanf("%d%d", &n, &m))
	{
		init();
		for (int i = 1; i <= m; ++i)
		{
			scanf("%d%d", &u, &v);
			addedge (u, v, i);
			addedge (v, u, i);
		}
		solve(n);
	}
	return 0;
}
